package com.zyf.mt.common;

import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;


public class JSONUtil {
    //遍历并删除

    public static void changeProperty(JSONArray ja){
        if (ja.size()>0){
            for (Object obj : ja){
                JSONObject jb = (JSONObject) obj;
                //jb.getJSONObject("list").put("children",jb.get("list"));
                jb.put("children",jb.get("list"));
                jb.remove("cord");
                jb.remove("list");
                jb.remove("type");
                if(jb.containsKey("children")){
                    JSONArray jr = (JSONArray) jb.get("children");
                    changeProperty(jr);
                }
            }
        }
    }
}
